﻿#include <stdio.h>
#define MAXN 10

struct student {
    int num;
    char name[20];
    int score;
    char grade;
};

int set_grade(struct student* p, int n);

int main()
{
    struct student stu[MAXN], * ptr;
    int n, i, count;

    ptr = stu;
    scanf_s("%d\n", &n);
    for (i = 0; i < n; i++) {
        scanf_s("%d%s%d", &stu[i].num, stu[i].name, &stu[i].score);
    }
    count = set_grade(ptr, n);
    printf("The count for failed (<60): %d\n", count);
    printf("The grades:\n");
    for (i = 0; i < n; i++)
        printf("%d %s %c\n", stu[i].num, stu[i].name, stu[i].grade);
    return 0;
}
int set_grade(struct student* p, int n) {
    int i, s, f = 0;
    for (i = 0; i < n; i++) {
        s = p[i].score;
        if (s >= 85 && s <= 100)p[i].grade = 'A';
        else if (s >= 85 && s <= 100) p[i].grade = 'B';
        else if (s >= 85 && s <= 100) p[i].grade = 'C';
        else { p[i].grade = 'D'; f++; }
    }

    return f;


}
